import React from 'react'
import {incre, decre} from '@app/slices/countSlice';
import { useAppDispatch, useAppSelector } from '@/app/hooks';

export default function ReduxCom() {
  //获取 count 的状态值
  let count = useAppSelector(state => state.count.value);
  //获取 dispatch 函数
  let dispatch = useAppDispatch();

  return (
    <div>
      <h2>{count}</h2>
      <button onClick={() => {
        dispatch(incre(2));
      }}>新增</button>
    </div>
  )
}
